package com.aaa.coupon.controller.api;

import com.aaa.coupon.service.CouponService;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 荆豪峰
 * @version 1.0
 * #Date: 2023/3/9 19:52
 */
@Api(value = "coupon/coupon", tags = {"#Date: 2023/3/9 19:52"})
@RestController
@RequestMapping("coupon/coupon")
public class CouponController {
    @Autowired
    private CouponService couponService;
    /**
     * #Description 查询未过期的优惠券
     * @param memberId
 * @param useStatus
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/14
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "memberId", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "useStatus", value = "", required = true)
    })
    @ApiOperation(value = "#Description 查询未过期的优惠券 #Date 2023/3/14", notes = "#Description 查询未过期的优惠券 #Date 2023/3/14", httpMethod = "GET")
    @GetMapping("list")
    public Result listCoupon(Integer memberId,Integer useStatus){
      return couponService.listCoupon(memberId,useStatus);
    }
    /**
     * #Description 查询已过期的优惠券
     * @param memberId
 * @param useStatus
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/14
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "memberId", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "useStatus", value = "", required = true)
    })
    @ApiOperation(value = "#Description 查询已过期的优惠券 #Date 2023/3/14", notes = "#Description 查询已过期的优惠券 #Date 2023/3/14", httpMethod = "GET")
    @GetMapping("listout")
    public Result listCouponout(Integer memberId,Integer useStatus){
        return couponService.listCouponout(memberId,useStatus);
    }
    /**
     * #Description 查询优惠券种类
     * @param 
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/14
     */
    @ApiOperation(value = "#Description 查询优惠券种类 #Date 2023/3/14", notes = "#Description 查询优惠券种类 #Date 2023/3/14", httpMethod = "GET")
    @GetMapping("getcoupon")
    public Result getcoupon(){
        return couponService.getcoupon();
    }
    /**
     * #Description 领取优惠券
     * @param memberId
     * @param couponId
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/14
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "memberId", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "couponId", value = "", required = true)
    })
    @ApiOperation(value = "#Description 领取优惠券 #Date 2023/3/14", notes = "#Description 领取优惠券 #Date 2023/3/14", httpMethod = "POST")
    @PostMapping("updateCouponout")
    public Result updateCouponout(Integer memberId,Integer couponId){
         return couponService.updateCouponout(memberId,couponId);
    }
}
